<div class="Item hr">
    <span class="fr">现有职位<b>{$rows_count}</b>个 <button class="btn add_oper" >添加招聘信息</button></span>
    <div class="current">职位列表</div>
</div>
<form>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab">
        <thead>
            <tr>
                <td>职位名称</td>
                <td>工作地点</td>
                <td>招聘人数</td>
                <td>发布时间</td>
                <td>操作</td>
            </tr>
        </thead>
        <tbody>
            <volist name="jobs" id="job">
            <tr align="center">
                <td>{$job['name']}</td>
                <td>
                    {$job['address']}
                </td>
                <td>
                    {$job['people_num']}
                </td>
                <td>
                    {:date('Y-m-d', $job['public_time'])}
                </td>
                <td>
                    [ <a href="{:U('Job/edit', array('id' => $job['id']))}">编辑</a> ]
                    [ <a href="javascript:void(0);" value="{:U('Job/delete', array('id' => $job['id']))}"  class="del">删除</a> ]
                </td>
            </tr>
            </volist>
        </tbody>
    </table>
</form>

<div class="page">
    {$page}
</div>
<script type="text/javascript">
    $(function(){
        $(".del").click(function(){
            var del_link = $(this).attr("value");
            popup.confirm('确定删除？','温馨提示',function(action){
                if(action == 'ok'){
                    $.getJSON(del_link, function(json){
                        if (json.status) {
                            popup.success(json.info);
                            setTimeout(function(){
                                popup.close("asyncbox_success");
                            },2000);
                        } else {
                            popup.error(json.info);
                            setTimeout(function(){
                                popup.close("asyncbox_error");
                            },2000);
                        }

                        setTimeout(function(){
                            top.window.location.reload();
                        },1000);
                    });
                }
            });

            return false;
        });

        $(".add_oper").click(function(){
            location.href="{:U('Job/add')}"
        });
    });
</script>